package com.bookmanger.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bookmanger.common.result.Result;
import com.bookmanger.entity.Category;
import com.bookmanger.mapper.CategoryMapper;
import com.bookmanger.service.CategoryService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author huangfuhao
 * @Date 2024/10/26
 */
@Service
public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> implements CategoryService {
    @Override
    public Result<List<Category>> getCategoryAll() {
        return Result.success(list());
    }

    @Override
    public Result<Integer> getCategoryCount() {
        Integer count = Math.toIntExact(baseMapper.selectCount(null));
        return Result.success(count);
    }
}
